import { Sequelize } from "sequelize";
import config from "../config/config.js";

const env = process.env.NODE_ENV || "development";
const { username, password, database, host, dialect } = config[env];

const sequelize = new Sequelize(database, username, password, {
  host,
  dialect,
  dialectOptions: {
    connectTimeout: 10000, // 设置连接超时时间为 10 秒
  },
});

export default sequelize;
